<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!-- AUTHOR: Dakota -->
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <f:facet name="first">
            <meta http-equiv="X-UA-Compatible" content="EmulateIE8" />
            <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
            <meta http-equiv="Cache-Control" content="no-cache" />
            <meta http-equiv="Pragma" content="no-cache" />
            <title><ui:insert name="title">LiveLab-Create Instructor</ui:insert></title>
        </f:facet>
        <title>LiveLab-Create Instructor</title>
        <style type="text/css">
            h1{
                color:darkblue;
            }
            blockquote{
                font-size:12px;
            }
            .ui-widget, .ui-widget .ui-widget {
                font-size: 90% !important;
            }
            body{
                font-size: 12px;
            }
        </style>
    </h:head>
    <h:body>
        <h:form id="form" >
            <h1>Java LiveLab Instructor Registration</h1>
            <h:panelGrid>
                <h:panelGroup>
                    <h:outputText   value="Signup Code:"/>
                    <h:outputText   value="*" style="color: red" />
                </h:panelGroup>
                <p:inputText    value="#{instructorRegisterBean.instructor.signupCode}" id="signupCode" required="true" requiredMessage="Signup code is required" validator="#{instructorRegisterBean.validateSignupCode}"/>
                <p:message for="signupCode" />
                
                <h:panelGroup>
                    <h:outputText   value="Username(e.g, firstNameLastName):" />
                    <h:outputText   value="*" style="color: red" />
                </h:panelGroup>
                <p:inputText    value="#{instructorRegisterBean.instructor.userName}" id="username" required="true" requiredMessage="Username is required" validator="#{instructorRegisterBean.validateUsername}" />
                <p:message for="username"/>
                
                <h:panelGroup>
                    <h:outputText   value="Password:" />
                    <h:outputText   value="*" style="color: red" />
                </h:panelGroup>
                <p:password    value="#{instructorRegisterBean.instructor.password}" feedback="false" binding="#{instructorRegisterBean.passInput}" id="password" required="true" requiredMessage="Password is required" validatorMessage ="Password should be of length from 1 to 100">
                    <f:validateLength minimum="1" maximum="100" for="password"/>
                </p:password>
                <p:message for="password"/>
                
                <h:panelGroup>
                    <h:outputText   value="Confirm Password:" />
                    <h:outputText   value="*" style="color: red" />
                </h:panelGroup>
                <p:password    value="#{instructorRegisterBean.confirmPassword}" feedback="false" binding="#{instructorRegisterBean.confPassInput}" id="confirmPassword" required="true" requiredMessage="Confirm password is required" validator="#{instructorRegisterBean.validatePassword}"/>
                <p:message for="confirmPassword"  />
                
                <h:panelGroup>
                    <h:outputText   value="Email:" />
                    <h:outputText   value="*" style="color: red" />
                </h:panelGroup>
                <p:inputText    value="#{instructorRegisterBean.instructor.email}" id="email" required="true" requiredMessage="Email is required" validator ="#{instructorRegisterBean.validateEmailAddress}" />
                <p:message for="email"/>
                
                <h:panelGroup>
                    <h:outputText   value="Course ID (e.g., NYUCS123Fall2013):" />
                    <h:outputText   value="*" style="color: red" />
                </h:panelGroup>
                <p:inputText    value="#{instructorRegisterBean.instructor.courseId}" id="courseId" required="true" requiredMessage="Course id is required" validatorMessage ="Course id should be of length from 1 to 100">
                    <f:validateLength minimum="1" maximum="100" for="courseId"/>
                </p:inputText>
                <p:message for="courseId"/>
                
                <h:panelGroup>
                    <h:outputText   value="Instructor First Name:" />
                    <h:outputText   value="*" style="color: red" />
                </h:panelGroup>
                <p:inputText    value="#{instructorRegisterBean.instructor.firstName}" id="instructorFirstName" required="true" requiredMessage="First name is required" validatorMessage ="First name should be of length from 1 to 100">
                    <f:validateLength minimum="1" maximum="100" for="instructorFirstName"/>
                </p:inputText>
                <p:message for="instructorFirstName"/>
                
                <h:panelGroup>
                    <h:outputText   value="Instructor Last Name:" />
                    <h:outputText   value="*" style="color: red" />
                </h:panelGroup>
                <p:inputText    value="#{instructorRegisterBean.instructor.lastName}" id="instructorLastName" required="true" requiredMessage="Course id is required" validatorMessage ="Course id should be of length from 1 to 100">
                    <f:validateLength minimum="1" maximum="100" for="instructorLastName"/>
                </p:inputText>
                <p:message for="instructorLastName"/>
                
                <h:outputText   value="School (Optional):"/>
                <p:inputText    value="#{instructorRegisterBean.instructor.school}" id="school" validatorMessage ="School should be less than 50 chars">
                    <f:validateLength maximum="50" for="school"/>
                </p:inputText>
                <p:message for="school"/>
                
                <h:outputText   value="State (Optional):" />
                <p:inputText    value="#{instructorRegisterBean.instructor.state}" id="state" validatorMessage ="State should be less than 25 chars">
                    <f:validateLength maximum="25" for="state"/>
                </p:inputText>
                <p:message for="state"/>
                
                <h:outputText   value="Country (Optional):" />
                <p:inputText    value="#{instructorRegisterBean.instructor.country}" id="country" validatorMessage ="Country should be less than 100 chars">
                    <f:validateLength maximum="50" for="country"/>
                </p:inputText>
                <p:message for="country"/>
            </h:panelGrid>      
            <p:commandButton id="submit" value="Register Instructor" process="@form" update="@form" action="#{instructorRegisterBean.registerInstructor}"/>
            <p:message for="submit" />
        </h:form>
    </h:body>
</html>

